#include <stdio.h>
#include <unistd.h>

#include "help/query.h"

// When trying to open for read while writing
// then program crashes
// TODO: fix it pls

int main(int argc, char* argv[]) {
    if (argc < 3) {
        return 1;
    }

    char* user = argv[1];
    char* unit = argv[2];

    float x = 0, y = 0, z = 0;

    for (;;) {
        query_unit_position(user, unit, &x, &y, &z);
        printf("%.3f %.3f %.3f\n", x, y, z);

        sleep(0.1);
    }

    return 0;
}